﻿using System;
using Db7;
using System.Html;
using Db7_ut.DomainObjects;


namespace Db7_ut.Views.SingleElementBinding
{
    public class TextBinding
    {
        Employee _emp;
        public TextBinding(string ContainerID)
        {
            _emp = new Employee();
            _emp.IDB = new StringBinder("12345");
            VInput input = new VInput();
            input.Value_DB = _emp.IDB;
            //input.Value = "hello";
            input.Type = "text";
            VirtualElement label = new VirtualElement();
            label.Tag = "span";
            RenderContext.RegisterOnClickHandler(label, OnClickLabel);
            //label.Text = "My Text Label";
            label.Text_DB = _emp.IDB;
            VirtualElement parent = new VirtualElement();
            parent.Tag = "div";
            parent.ChildrenNN.Add(label);
            parent.ChildrenNN.Add(input);
            parent.RenderInside(ContainerID);
        }

        public void OnClickLabel(ElementEvent evt)
        {
           
            this._emp.Save(OnSave);
        }

        public void OnSave()
        {
        }
    }
}
